package com.uenpay.im.ui.old.activity.funds;

import com.uenpay.im.configuration.APIConfiguration;
import com.uenpay.im.entities.HttpInvokeResult;
import com.uenpay.im.invokeitems.BaseHttpInvokeItem;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author SL
 * @created 2016-3-22 下午6:56:47
 * @copyRight http://www.qiyunxin.com
 * @function 群成员交经费
 */
public class DoContributInvokeItem extends BaseHttpInvokeItem {

	public class DoContributInvokeItemResult extends HttpInvokeResult {
	}

	public DoContributInvokeItemResult getOutPut() {
		return (DoContributInvokeItemResult) GetResultObject();
	}

	/**
	 * 群成员交经费
	 * @param contributid
	 * @param paypassword
	 */
	public DoContributInvokeItem(String contributid, String paypassword) {
		String url = APIConfiguration.getBaseUrl()
				+ "Chat/SpecialChat/doContribut?contributid=" + contributid
				+ "&paypassword=" + paypassword + "&"
				+ APIConfiguration.getCustIdAndToken();
		SetUrl(url);
	}

	@Override
	protected Object DeserializeResult(String responseBody) {
		DoContributInvokeItemResult result = new DoContributInvokeItemResult();
		JSONObject json = null;
		try {
			json = new JSONObject(responseBody);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		if (json == null) {
			return result;
		}
		result.status = json.optInt("status");
		result.msg = json.optString("msg");

		return result;
	}

}
